//
//  NSString+Path.m
//  JQKit
//
//  Created by JQZ on 2018/4/27.
//  Copyright © 2018年 JQZ. All rights reserved.
//

#import "NSString+Path.h"

@implementation NSString (Path)

+ (NSString *)documentsPath
{
    return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
}

+ (NSString *)cachesPath
{
    return [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
}

+ (NSString *)libraryPath
{
    return [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) firstObject];
}

+ (NSString *)tempPath
{
    return NSTemporaryDirectory();
}

- (NSString *)appendDocumentsPath
{
    return [[NSString documentsPath] stringByAppendingPathComponent:self];
}

- (NSString *)appendCachesPath
{
    return [[NSString cachesPath] stringByAppendingPathComponent:self];
}

- (NSString *)appendLibraryPath
{
    return [[NSString cachesPath] stringByAppendingPathComponent:self];
}

- (NSString *)appendTempPath
{
    return [[NSString tempPath] stringByAppendingPathComponent:self];
}

@end
